package com.wangshouyu.mp.pay.v3.transactions;

import com.wangshouyu.mp.pay.v3.common.enums.TransactionsType;
import com.wangshouyu.mp.pay.v3.common.request.BaseV3PayRequest;

import java.util.Objects;

/**
 * @author 王守钰
 * @description 交易请求
 * @date 2020/8/14 10:00
 */
public class TransactionsRequest<Transactions extends BaseTransactionsRequest> extends BaseV3PayRequest {

    /**
     * 交易信息
     */
    private Transactions transactions;

    /**
     * 交易类型
     */
    private TransactionsType type;

    public Transactions getTransactions() {
        return transactions;
    }

    public void setTransactions(Transactions transactions) {
        this.transactions = transactions;
    }

    public TransactionsType getType() {
        return type;
    }

    public void setType(TransactionsType type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        TransactionsRequest<?> that = (TransactionsRequest<?>) o;
        return Objects.equals(transactions, that.transactions) &&
                type == that.type;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), transactions, type);
    }

    @Override
    public String toString() {
        return "TransactionsRequest{" +
                "transactions=" + transactions +
                ", type=" + type +
                '}';
    }
}
